﻿<UserControl x:Name="userControl" x:Class="WinMilk.Gui.Controls.AddTaskControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:con="clr-namespace:WinMilk.Gui.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="800" d:DesignWidth="480"
    Loaded="UserControl_Loaded"
    con:TiltEffect.IsTiltEnabled="True"
    DataContext="{Binding RelativeSource={RelativeSource Self}}" Visibility="Collapsed">

    <UserControl.Resources>
        <Storyboard x:Name="SwivelIn">
            <DoubleAnimation BeginTime="0:0:0" Duration="0" 
                                Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationY)"
                                Storyboard.TargetName="MainGrid"
                                To=".5"/>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="MainGrid">
                <EasingDoubleKeyFrame KeyTime="0" Value="-90"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.35" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ExponentialEase EasingMode="EaseOut" Exponent="6"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                            Storyboard.TargetName="MainGrid">
                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Name="SwivelOut">
            <DoubleAnimation BeginTime="0:0:0" Duration="0" 
                                Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationY)" 
                                Storyboard.TargetName="MainGrid"
                                To=".5"/>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="MainGrid">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="45">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ExponentialEase EasingMode="EaseIn" Exponent="6"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                            Storyboard.TargetName="MainGrid">
                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.267" Value="0" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid x:Name="MainGrid" Width="480" Height="Auto" 
              Background="{StaticResource PhoneAccentBrush}" 
              VerticalAlignment="Top" Canvas.ZIndex="1" Margin="{Binding MainGridMargin}">
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
            <Grid.RenderTransform>
                <CompositeTransform/>
            </Grid.RenderTransform>

            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="80" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Text="{Binding Path=Loc.SmartAddHeader, Source={StaticResource L10N}}" 
                       Grid.Row="0" Margin="12,0" FontSize="{StaticResource PhoneFontSizeExtraLarge}" />
                
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBox x:Name="SmartAddBox" Grid.Column="0" KeyUp="SmartAddBox_KeyUp" InputScope="Text"/>
                <con:BigIconButton x:Name="SmartAddButton" Grid.Column="1" Click="SmartAddButton_Click" Type="add"/>
            </Grid>

            <TextBlock Text="{Binding Path=Loc.SmartAddExample, Source={StaticResource L10N}}"
                       Grid.Row="2" Margin="12,0,12,10"/>
            

            <HyperlinkButton x:Name="AdvancedAddButton" Content="{Binding Path=Loc.AdvancedTaskAddLink, Source={StaticResource L10N}}" Grid.Row="3" HorizontalAlignment="Left" Click="AdvancedAddButton_Click" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="0,5" />
            <!--<HyperlinkButton x:Name="CancelSmartAddButton" Content="{Binding Path=Loc.CancelTaskAddLink, Source={StaticResource L10N}}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" Click="CancelSmartAddButton_Click" />-->
        </Grid>
        <Canvas Name="Overlay" MouseLeftButtonDown="Overlay_MouseLeftButtonDown">
            <Canvas.Background>
                <SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}" />
            </Canvas.Background>
        </Canvas>
    </Grid>
</UserControl>
